package com.zhy.learning.demo.unsafe;

import sun.misc.Unsafe;

import java.lang.reflect.Field;

public class GetUnsafeInstance {

    public static void main(String[] args) throws NoSuchFieldException, IllegalAccessException {
        Class clazz = Unsafe.class;
        Field f = clazz.getDeclaredField("theUnsafe");
        f.setAccessible(true);
        Unsafe unsafe = (Unsafe) f.get(clazz);
        System.out.println(unsafe);

        Unsafe.getUnsafe();
    }
}
